{% extends base.html %}

{% block body %}

{% init url = "" %}
{% init body = "" %}
{% init method = "GET" %}
{% init cookie = "" %}
{% init response = "" %}
{% init response_headers = [] %}
{% init status = "" %}

<h2>cURL模拟器</h2>

<form method="GET">

<div class="col-md-12">
    <h3>cURL</h3>
    <textarea name="url" rows=3 class="col-md-12" >{{url}}</textarea>
</div>
<div class="col-md-12">
    <select name="method">
        <option vlaue="POST" {% if method == "POST" %} selected="true" {% end %} >POST</option>
        <option value="GET" {% if method == "GET" %} selected="true" {% end %}>GET</option>
    </select>
    <select name="content_type">
        <option value="application/json">JSON</option>
        <option value="application/x-www-form-urlencoded">urlencoded</option>
    </select>
</div>

<div class="col-md-12">
<h3>Cookie</h3>
<textarea name="cookie" class="col-md-12" rows=5>{{cookie}}</textarea>
</div>

<div class="col-md-12">
<h3>Data</h3>
<textarea name="body" class="col-md-12" rows=10>{{body}}</textarea>
</div>
<button>查询</button>
</form>

<h3>Response</h3>
<textarea class="col-md-12" rows=10>{{response}}</textarea>

<h3>status</h3>
<pre>{{status}}</pre>

<h3>Response Headers</h3>
<pre>{% for header in response_headers %}{{":".join(header)}}
{%end%}</pre>

{% end %}